<?php
/*
class data {
      
      public function ConverteData($Data){
         if (strstr($Data, "/"))//verifica se tem a barra /
         {
             $d = explode ("/", $Data);//tira a barra
             $rstData = "$d[2]-$d[1]-$d[0]";//separa as datas $d[2] = ano $d[1] = mes etc...
             return $rstData;
          } elseif(strstr($Data, "-")){
             $d = explode ("-", $Data);
             $rstData = "$d[2]/$d[1]/$d[0]";
             return $rstData;
          }else{
             return "Data invalida";
          }
      }

      public function valida_data($data)
      {
            $data = split("[-,/]", $data);
            if(!checkdate($data[1], $data[0], $data[2]) and !checkdate($data[1], $data[2], $data[0])) {
            return false;
            }
            return true;
      }

      public function converte_data($data)
      {
          if(valida_data($data)) {
          return implode(!strstr($data, '/') ? "/" : "-", array_reverse(explode(!strstr($data, '/') ? "-" : "/", $data)));
          }
      }

}     */

?>
